﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="MedicalReportList.aspx.cs" Inherits="Physio_Clinic.MedicalReportList" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <% if (currentUser != null && currentUser.Username == "admin")
       {   
      %>
    <a href="MedicalReportList.aspx">รายงานผลการรักษา</a>
    <br />
    <br />
            <asp:Calendar ID="CalendarOrder" runat="server" 
            onselectionchanged="Calendar1_SelectionChanged"></asp:Calendar>
    <br />
    ผู้ป่วย :<br />
    <asp:DropDownList ID="DropDownList1" runat="server" 
        DataSourceID="LinqDataSource3" DataValueField="Id" DataTextField="UserName" 
        AutoPostBack="True">
    </asp:DropDownList>
    <br />
    <br />
    <asp:GridView ID="GridSearchResultList" runat="server" AutoGenerateColumns="false"
    BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" CellSpacing="1"
    GridLines="None" ShowHeaderWhenEmpty="True"
        Font-Names="Arial" Font-Size="11pt" AlternatingRowStyle-BackColor="#C2D69B" HeaderStyle-BackColor="blue"
        PageSize="10" DataKeyNames="BookId" DataSourceID="LinqDataSource2" 
        OnSelectedIndexChanged="GridSearchResultList_SelectedIndexChanged" 
        OnRowCommand="GridView1_RowCommand">
        <Columns>
            <asp:CommandField ShowSelectButton="True" SelectText="เลือก" />
            <asp:BoundField DataField="BookId" HeaderText="รหัสการจอง" />
            <asp:BoundField DataField="UserName" HeaderText="ชื่อผู้ใช้" />
            <asp:BoundField DataField="AppointmentTime" HeaderText="เวลาเริ่มนัดหมาย" />
            <asp:BoundField DataField="EndappointmentTime" HeaderText="เวลาสิ้นสุดนัดหมาย" />
            <asp:ButtonField Text="รูปผลการรักษา" CommandName="seePic"/>
        </Columns>
                    <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
            <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
            <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
            <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
            <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#594B9C" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#33276A" />
    </asp:GridView>
    <asp:LinqDataSource ID="LinqDataSource2" runat="server" ContextTypeName="Physio10Context.Physio10DataContext"
        EntityTypeName="" TableName="Bookings" Where="UserId == Convert.ToInt32(@UserId)
        &&AppointmentTime.Value.Date == @AppointmentTime&&UserId == Convert.ToInt32(@Id)">
        <WhereParameters>
            <asp:SessionParameter Name="UserId" SessionField="currentUserId" Type="Int32" />
            <asp:ControlParameter ControlID="CalendarOrder" Name="AppointmentTime" 
                PropertyName="SelectedDate" Type="DateTime" />
            <asp:ControlParameter ControlID="DropDownList1" Name="Id" 
                PropertyName="SelectedValue" />
        </WhereParameters>
    </asp:LinqDataSource>
    <asp:LinqDataSource ID="LinqDataSource3" runat="server" 
        ContextTypeName="Physio10Context.Physio10DataContext" EntityTypeName="" 
        TableName="Qf8soUsers">
    </asp:LinqDataSource>
    <br />


            <% }
       else
       { %><asp:Label ID="ErrorText" runat="server" 
    Text="สิทธิหน้านี้สำหรับ ผู้ดูเเลระบบเท่านั้น " ForeColor="Red" 
        style="text-align: center"></asp:Label><asp:HyperLink ID="HyperLink1" 
    runat="server" NavigateUrl="http://physio10.com/" > click</asp:HyperLink><% } %>
</asp:Content>
